package com.rongshu.view.home.presenter;

import com.rongshu.api.RetorfitService;
import com.rongshu.view.home.contract.CatalogueView;
import com.rongshu.view.home.entity.CatalogInfo;

import rx.Subscriber;
import rx.functions.Func1;

public class CataloguePresenter {

    public CatalogueView mView = null;

    public CataloguePresenter(CatalogueView view) {
        this.mView = view;
    }


    /**
     * 连载目录
     */
    public void getCatalogue(int user_id, int serialize_id,
                             int pageIndex, int pageSize, String sign) {
        RetorfitService.getCatalogue(user_id, serialize_id, pageIndex, pageSize, sign)
                .subscribe(new Subscriber<CatalogInfo>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(CatalogInfo catalogInfo) {
                        if (mView != null) {
                            mView.onCatalogueMsg(catalogInfo);
                        }
                    }
                });
    }

}
